import os

def remove_matching_files(folder_a, folder_b):
    # 获取folder_b中的所有文件名（忽略后缀）
    files_in_b = {os.path.splitext(filename)[0] for filename in os.listdir(folder_b) if os.path.isfile(os.path.join(folder_b, filename))}
    
    # 遍历folder_a中的文件
    for filename in os.listdir(folder_a):
        file_path = os.path.join(folder_a, filename)
        # 检查是否为文件且文件名（忽略后缀）在folder_b中存在
        if os.path.isfile(file_path) and os.path.splitext(filename)[0] in files_in_b:
            os.remove(file_path)
            print(f"Deleted: {file_path}")

# 使用示例
folder_a = '/path/to/folder_a'
folder_b = '/path/to/folder_b'
remove_matching_files(folder_a, folder_b)